package com.atguigu.client;

import com.atguigu.bean.idName;
import com.atguigu.entity.*;
import com.atguigu.fallback.ProductFallback;
import com.atguigu.result.RetVal;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * ProductFeignClient
 *
 * @author yangchao
 * @version 开发阶段
 * @description TODO
 * @date 2022/1/9 16:44
 */
@FeignClient(value = "shop-product",fallback = ProductFallback.class)
public interface ProductFeignClient {

    //1.根据skuid查询sku_info信息  包括图片
    @GetMapping("sku/getSkuInfo/{skuId}")
    public SkuInfo getSkuInfo(@PathVariable Long skuId);

    //2.根据skuId查询spu的销售属性key与value
    @GetMapping("sku/getSpuSaleProperty/{productId}/{skuId}")
    public List<ProductSalePropertyKey> getSpuSaleProperty(@PathVariable long productId, @PathVariable long skuId);

    //3.根据skuId 查询商品的价格
    @GetMapping("sku/getSkuPrice/{skuId}")
    public BigDecimal getSkuPrice(@PathVariable long skuId);
    //4.获取sku的分类信息
    @GetMapping("sku/getCategoryView/{category3Id}")
    public BaseCategoryView getCategoryView(@PathVariable long category3Id);
    //5.通过spuId 获取对应的Json 字符串。
    @GetMapping("sku/getSkuSalePropertyValueIdMapping/{productId}")
    public Map getSkuSalePropertyValueIdMapping(@PathVariable long productId);
    // 获取首页分类数据
    @GetMapping("/product/getIndexCategoryInfo")
    public RetVal getIndexCategoryInfo();
    //6.通过brandId查询品牌信息
    @GetMapping("/sku/getBrandById/{brandId}")
    public BaseBrand getBrandById(@PathVariable Long brandId);

    //7.根据skuId查询平台属性信息
    @GetMapping("/product/getPlatformPropertyBySkuId/{skuId}")
    public List<PlatformPropertyKey> getPlatformPropertyBySkuId(@PathVariable Long skuId);

    @GetMapping("/product/getSkuInfoForView")
    public List<idName> getSkuInfoForView();
}
